package com.zsy.provider.api.feign.hystrix;

import com.zsy.base.bean.DemoResult;
import com.zsy.dao.model.TbPermission;
import com.zsy.dao.model.TbUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.List;

/**
 * uacfeign 服务熔断和降级,不需要相关熔断异常
 */
@Component
@Slf4j
//public class UacFeignFallback implements UacService {
public class UacFeignFallback  {

    /**
     * 获取用户列表
     *
     * @param id
     * @return
     */
    public DemoResult<Object> listUser(String id) {
        log.info("服务熔断和降级id：{}",id);
        return DemoResult.FAIL("服务繁忙，请稍后重试！id="+id);
    }

    /**
     * @param userName
     * @return com.zsy.base.bean.DemoResult<java.lang.Object>
     * @Author zhaoshouyun
     * @Description 获取用户信息
     * @Date 2020-04-15 05:15
     * @Param userName
     */
    public DemoResult<TbUser> getUserByUserName(String userName) {
        log.info("服务熔断和降级id：{}",userName);
        return DemoResult.FAIL("服务繁忙，请稍后重试！userName="+userName);
    }

    /**
     * 获取权限列表
     *
     * @param id
     * @return com.zsy.base.bean.DemoResult<com.zsy.dao.oauth2.model.TbPermission>
     * @Author zhaoshouyun
     * @Description
     * @Date 2020-04-15 05:36
     * @Param id
     */
    public DemoResult<List<TbPermission>> selectPermissionsByUserId(BigDecimal id) {
        log.info("服务熔断和降级id：{}",id);
        return DemoResult.FAIL("服务繁忙，请稍后重试！id="+id);
    }
}
